package com.wfh.config;


import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.model.openai.OpenAiStreamingChatModel;
import jakarta.annotation.Resource;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.util.List;

/**
 * @Title: ThinkingStreamChatModelConfig
 * @Author wangfenghuan
 * @Package com.wfh.aigenerator.config
 * @Date 2025/8/5 20:12
 * @description:
 */
@ConfigurationProperties(prefix = "langchain4j.open-ai.streaming-chat-model")
@Configuration
@Data
public class StreamChatModelConfig {

    private String baseUrl;

    private String apiKey;

    private String modelName;


    /**
     * 流式模型
     * @return
     */
    @Bean
    @Scope("prototype")
    public StreamingChatModel streamingChatModelPrototype() {
        return OpenAiStreamingChatModel.builder()
                .apiKey(apiKey)
                .baseUrl(baseUrl)
                .logRequests(true)
                .logResponses(true)
                .modelName(modelName).build();
    }
}
